<%@ page import="java.util.HashMap,common.CommonUtil,java.util.*,common.*" contentType="text/html; charset=utf-8" %>
<%@ taglib uri="/WEB-INF/commontags.tld" prefix="common" %><%--페이징처리tag--%>
<%
UserSession userSession = (UserSession)session.getAttribute("user"); 

String user_id = null;
String level = null;

if(userSession!= null){
	user_id = userSession.getUser_id();
	level = userSession.getAdmin_level();
}

String member_id 	= CommonUtil.nvl(request.getParameter("member_id"),"");
String log_gubun	= CommonUtil.nvl(request.getParameter("log_gubun"),"opic");

HashMap listMap=(HashMap)request.getAttribute("list_map");

HashMap map  = null;
ArrayList list=null;


String uni_id 		= "";
String test_gb 		= "";
String scr_url 		= "";
String conn_dt 	= "";
String user_ip 		= "";
String year 	= "";
String month	= "";
String day	= "";
String time	= "";

String login_id	= "";
String login_name	= "";
String referer_url	= "";

String email	= "";
String cell_no	= "";

if (listMap!=null){
    list=(ArrayList)listMap.get("mainContent");
}

if(list != null){
	if(list.size() > 0){
				
		login_name = CommonUtil.nvl((String)((HashMap)list.get(0)).get("login_name"));
	    login_id = CommonUtil.nvl(Crypto.DecodeBySType((String)((HashMap)list.get(0)).get("login_id")));
	    email = CommonUtil.nvl((String)((HashMap)list.get(0)).get("email"));
	    cell_no = CommonUtil.nvl((String)((HashMap)list.get(0)).get("cell_no"));
	}
}

%>
<jsp:include page="/jsp/common/header.jsp"></jsp:include>
<script>
function go_log(g){
	var frm = document.mainform;
	if(g=='first_log'){
		frm.cmd.value="member_test_first_log";
	}else if(g=='test_log'){
		frm.cmd.value="member_test_log";
	}else if(g=='opic_stat'){
		frm.cmd.value="member_opic_stats";
	}else if(g=='ts_stat'){
		frm.cmd.value="member_ts_stats";
	}
	frm.action = '/speaking.pb';
	frm.target = '_self';
	frm.submit();
	
}
</script>

<form name="mainform"  method="post" action = "/speaking.pb" >
	<div id="bodyContainer">
        <div id="contents">
        
          <div class="menu">
            <ul>
              <li><a href="#" onclick="go_log('first_log')" class="menuOn">접속로그</a></li> 
              <!-- <li><a href="#" onclick="go_log('test_log')" class="">시험로그</a></li>  -->
              <li><a href="#" onclick="go_log('opic_stat')" class="">OPIc 시험통계</a></li>
              <li><a href="#" onclick="go_log('ts_stat')" class="">T/S 시험통계</a></li>
            </ul>
          </div>
          
          <dl style="padding:20px 5px 5px 12px;">        
              <dt style="padding-left:20px;font-weight:bold;font-size:14px"><%=login_name %>(<%=login_id %>)님의 접속로그 </dt>
          </dl>
          
          <div class="boxContainer">
            <dl title="Log">
              <dt>접속로그</dt>
            </dl>
            <table class="listTb">
              <tr>
                <th>번호</th>
                <th>구분</th>
                <th >년</th>
                <th >월</th>
                <th >일</th>
                <th >시간</th> 
                <th>IP</th>
              </tr>
<%               

    if (list!=null && list.size()> 0) {
    	for(int i=0; i<list.size(); i++){
	      map=(HashMap)list.get(i);
	      uni_id = CommonUtil.nvl((String)map.get("uni_id"));
	      test_gb = CommonUtil.nvl((String)map.get("test_gb"));
	      scr_url = CommonUtil.nvl((String)map.get("scr_url"));
	      conn_dt = CommonUtil.nvl((String)map.get("conn_dt"));
	      user_ip = CommonUtil.nvl((String)map.get("user_ip"));
	      year = CommonUtil.nvl((String)map.get("year"));
	      month = CommonUtil.nvl((String)map.get("month"));
	      
	      day = CommonUtil.nvl((String)map.get("day"));
	       
	      time = CommonUtil.nvl((String)map.get("time"));
	      
	      referer_url = CommonUtil.nvl((String)map.get("referer_url"));
%>
			<tr>
                <td><%=i+1 %></td>
                <td><%=test_gb %></td>
                <td><%=year %></td>
                <td><%=month %></td>
                <td><%=day %></td>
                <td><%=time %></td>
                <td><%=user_ip %></td>
                
             </tr>
<%	      
    	}
      
    }else{

%> 
    				<tr>
    	                <td colspan=10 align=center>로그가 없습니다.</td>
    	            </tr>
<%
   }
%>
            </table>
            
           
          </div>
          
        </div>
      </div>

<input type=hidden name=member_id value="<%=member_id %>">
<input type=hidden name=member_name_print value="<%=login_name %>">
<input type=hidden name=member_id_print value="<%=login_id %>">
<input type="hidden" name="cmd" value="">
<input type=hidden name=log_gubun value="<%=log_gubun %>">
</form>

<iframe name='hidden_frm'  width='0' height='0' SCROLLING='AUTO' frameborder='0'></iframe>

<jsp:include page="/jsp/common/bottom.jsp"></jsp:include>
